import React from 'react';

class AuthWraper extends React.Component {

    constructor(props) {
        super(props);

        //后台取得
        this.rightMap = {
            '1001': true,
            '1002': false
        }

        this.has_right = this.rightMap[this.props.right_id] || false

        if (this.props.other_and != undefined) {
            this.has_right = this.has_right && this.props.other_and
        }

        if (this.props.other_or != undefined) {
            this.has_right = this.has_right || this.props.other_or
        }
    }

    render() {
        return (
            <React.Fragment>
                {
                    this.has_right ? this.props.children : null
                }
            </React.Fragment>
        )

    }

}
export default AuthWraper;